﻿<!--{inc(header.view.html)}-->

<div class="content" id="content">
	<div class="top-menu-box">
    	<div class="z">
            <span class="z-f"><a href="#">网站设置</a>&nbsp;&gt;</span>
            <span class="z-f"><a href="#">Icon数据库表视图修改</a></span>
            <div class="z-f-r"><span class="user-t"><a href="{$site_url}"  target="_blank">网站首页</a></span><span class="user-info"></span><a href="index.php?app=default&act=quit" onClick="return confirm('确认退出管理系统吗？');"   >退出管理</a></div>
        </div>
        <div class="top-menu">
        	<ul>
                                                 <li><a href="?app=icon&act=viewmanageedit&{$urlstr}"   target="_self">Icon标签修改</a></li>
												 <li class="current"><a href="#" >Icon数据库表视图修改</a></li>	
												 <li><a href="?app=icon&act=viewmanagetableuseredit&{$urlstr}"   target="_self">用户视图数据库修改</a></li>	
                                                 <li><a href="?app=icon&act=viewmanageactiveedit&{$urlstr}"   target="_self">Icondata时间控制修改</a></li>	
												 <li><a href="?app=icon&act=viewmanagetableedit&{$urlstr}&tb=usermoney.userid|users.id&fd=users.id|usermoney.intro"   target="_self">Icon表单数据调用</a></li>																			 
												 <li><a href="?app=icon&act=viewmanagecacheedit&{$urlstr}"   target="_self">Icon缓存数据调用</a></li>													
												 <li><a href="?app=icon&act=viewmanagehtmledit&{$urlstr}"   target="_self">HTML修改</a></li>	
                                                 <li><a href="{$fromurl}"   target="_self">返回主站</a></li>	
				
				
            </ul>
            <div class="clear"></div>
        </div>
    </div>
    
    <div class="main">


<?php 

if(!isset($data.iconname)) { $data.iconname='';} 
if(!isset($data.description)) { $data.description='';} 
if(!isset($data.iconcontent)) { $data.iconcontent='';} 
if(!isset($data.config.tablename)) { $data.config.tablename='';} 
if(!isset($data.config.fields)) { $data.config.fields='';} 
if(!isset($data.config.order)) { $data.config.order='';} 
if(!isset($data.config.limit)) { $data.config.limit='';} 
if(!isset($data.config.conditions)) { $data.config.conditions='';} 
if(!isset($data.config.pageurl)) { $data.config.pageurl='';} 
if(!isset($data.config.cachedatadir)) { $data.config.cachedatadir='';} 
if(!isset($data.config.cachefields)) { $data.config.cachefields='';} 
if(!isset($data.config.icondata)) { $data.config.icondata='';} 
if(!isset($data.config.iconfields)) { $data.config.iconfields='';} 
if(!isset($data.config.labels)) { $data.config.labels='';} 
if(!isset($data.config.htmlname)) { $data.config.htmlname='';} 
if(!isset($data.config.htmlconfig)) { $data.config.htmlconfig='';} 

?>                                
                                 


<form action="?app=icon&act=viewmanagedataedit&action=post" method="post" enctype="multipart/form-data" name="form1"  onSubmit="return post(this);">

<table  class="data" >
<tbody>

    <tr  onMouseOut="this.className=''" onMouseOver="this.className='bgcolor'"> 
      <td width='20%' align='right' ><font color=red>*</font><strong>栏目选择</strong>:</td>
      <td width='80%'  > 
        <!--
-->
<style>
.pub_cate_menu{ 
border:1px #CCCCCC solid; 
background-color:#f9f9f9;
color:#333333;
width:350px;
height:200px;
float:left;
overflow-Y:auto;
overflow-X:hidden;
margin-right:5px; 
padding:5px;
}
.pub_cate_menu a{
color:#343434;
line-height:150%;
}
.pub_cate_menu .selected{
 font-weight:bold; color:#FF3300; padding-right:20px; background:url({$web_view_dir}style/images/icn_ok.gif) right no-repeat;
}
.pub_cate_menu unselected{
}

.choosedok{ width:500px;}

</style>

<div id="cate_menu" style="display:block">
<div class="pub_cate_menu" id="cate_menu_1">
<?php foreach($categorydata as $_key => $_value ) { ?>
<?php if($_value.alias) { ?> 
	<div><a href="javascript:;" onClick="changeClassName(1,this,'{$_key}_{$_value1.cat_id}',true,0,'{$site_url}/admin/');" >{$_value.alias}</a></div>
<?php foreach((array)$_value.category as $_key1 => $_value1 ) { ?>
<?php if($_value1.cat_name) { ?> 
	<div><a href="javascript:;" onClick="changeClassName(1,this,'{$_key}_{$_value1.cat_id}',true,0,'{$site_url}/admin/');">|--{$_value1.str_pad}{$_value1.cat_name}</a>(点击进入下一页)</div>	
<?php } ?> 	
<?php } ?> 

<?php } ?> 
<?php } ?> 

 
</div>

<div class="pub_cate_menu" id="cate_menu_2"></div>

 
</div>

<iframe id="likeajaxform" src="about:blank" style="display:none;"></iframe>

<input type="hidden" value="0" id="fid"  name="fid"/>
<input name="ctype" type="hidden" id="ctype" value="0" />
<input name="id" type="hidden" id="id" value="0" />

<div style="clear:both;  padding:5px 8px 8px 35px;background:url({$web_view_dir}style/images/jiantou.jpg) left no-repeat;"  class="jiantou">
<span id="choosed" class="post_notice " >您当前选择的是:</span> &nbsp; 
 <input type="button"  value="↓ 添加" id="nextdo" disabled="disabled" style="background:none;background-color:#E8F3FC; height:auto; color:#FF0000" onClick="addFid();"/>
</div>
<div class="pub_cate_menu choosedok">
<strong>已经选择好的项目</strong>：(最多添加100个项目,<input name="no" type="checkbox" value="0" /><font color="blue">取消勾选即为移除对应分类</font>)
<div id="fiddb">
{$icontabledata}

</div>

</div>

<div style="clear:both"><input type="radio" name="fenorxin" value="1" <?php if($is_fenorxin == 1) { ?> checked <?php } ?>  >使用分类项&nbsp;&nbsp;&nbsp;<input type="radio" name="fenorxin" value="0"  <?php if($is_fenorxin == 0) { ?> checked <?php } ?>   >使用信息项</div>
<div style="clear:both">显示条数&nbsp;&nbsp;&nbsp;<input type="text" name="limitnum" value="{$limitnum}" size="20"></div>
<script language="javascript">
var g_page=1;
var g_fid = '';
var start_fid='';
var select_str = '';
//发布页选择类目JS动作
function changeClassName(slevel,my,fid,next,ctype,Murl)
{
    if(start_fid=='')
	{
	start_fid = fid;
	}
    if(start_fid)
	{
	  str1 = start_fid.split("_");
	  str2 = fid.split("_");
	  if(str1[0]!=str2[0])
	  {
	  	start_fid = fid;
		document.getElementById('cate_menu_2').innerHTML="";
		document.getElementById('fiddb').innerHTML="";
		document.getElementById('input').innerHTML="";		  
	  }
	}	
    if(fid==g_fid)
	{
	   g_page++;	   
	}else
	{
	g_page=1;
	}
	g_fid=fid;

	if(slevel>4) return false;
	for(var i=slevel+1;i<=2;i++){
		document.getElementById('cate_menu_'+String(i)).innerHTML="";			
	}
	
	document.getElementById("likeajaxform").src=Murl+'?app=icon&act=viewmanagedataedit&action=getfidsonslist&fup='+fid+'&class='+String(slevel+1)+"&ctype="+ctype+"&page="+g_page;
	
	var mydiv =document.getElementById('cate_menu_'+String(slevel));
	var mydivs=mydiv.getElementsByTagName('a');
	for(var i=0;i<mydivs.length;i++)
	{	
		mydivs[i].className='unselected';
	}
	my.className='selected';
	document.getElementById('fid').value=fid;
	if(next==false){
		document.getElementById('nextdo').disabled=false;
	}else{
		document.getElementById('nextdo').disabled="disabled";
	}
	
	create_mycate(slevel);
	
}
function create_mycate(slevel)
{
	var str='您当前选择的是:<font color="#232323">';

	for(var i=1;i<=slevel;i++)
	{
		var str2=getmydivs_choosedName(i);
		if(str2!=''){
		str+=" &gt; ";
		str+=str2;
		}		
	}
	document.getElementById('choosed').innerHTML=str+"</font>";
}
function getmydivs_choosedName(myi)
{
	var mydiv =document.getElementById('cate_menu_'+String(myi));
	var mydivs=mydiv.getElementsByTagName('a');
	for(var i=0;i<mydivs.length;i++)
	{	
		if(mydivs[i].className=='selected'){
			return mydivs[i].innerHTML;
		}
	}
	return "";

}
function inputcontent(content,slevel,select_str1){
    if(content=='&nbsp;')
	{
	alert('当前是该分类的最后一页内容，请切换分类进行选择！');
	return true ;
	}
	inputcontent_to(content,'cate_menu_'+String(slevel),select_str1);
}
function inputcontent_to(content,id,select_str1){
    select_str = select_str1;
	document.getElementById(id).innerHTML=content;
}

function addFid(){
	var fid=document.getElementById('fid').value;
	var str=document.getElementById('choosed').innerHTML.replace("您当前选择的是:"," ");
	var fiddb=document.getElementById('fiddb');
	try{
		var fiddbname=fiddb.getElementsByTagName('input');
		if(fiddbname.length>=100){
			alert('最多添加100个项目');
			return false;
		}
		for(var i=0;i<fiddbname.length;i++){
			if(fiddbname[i].value==fid){
				alert('不能重复添加!');
				return false;
			}
		}		
	}catch(e){
		
	}
	var onestr="<div id='div_"+fid+"'><input type='checkbox' name='fids[]' value='"+fid+"' checked onclick='removeFid(this);'> "+str+"</div>";
	fiddb.innerHTML=fiddb.innerHTML+onestr;
}
function removeFid(me){
	if(!confirm('确定放弃此项吗?')){
		me.checked=' checked';
		return false;
	}else{
		
		document.getElementById("div_"+me.value).innerHTML="";	
		document.getElementById("div_"+me.value).outerHTML="";	
		
	}
}
</script>


      </td>
    </tr>

<tr onMouseOut="this.className=''" onMouseOver="this.className='bgcolor'">
	<td align='right'><strong>样式选择</strong>:</td>
	<td>

<style>
/**********/
.mtop a{
	display:block;
	float:left;
	width:75px;
	height:19px;
	margin-top:5px;
	background:url(button_b.gif);
	text-align:center;
	margin-right:2px;
	padding-top:3px
}
.mtop a.cht{
	color:#fff;
	font-weight:bold;
	background:url(button_a.gif);
}
.mtop{
	border-bottom:2px solid #99D3FB;
}

.showpicdiv{
	border:5px solid #B9D5F2;
}
.showpicdiv2{
	border:1px solid red;
}

.disableTR td,.disableTR td input,.disableTR td a,.disableTR td a:visited,.disableTR td font{
	color:#ccc;
	border:0px;
}
.disableTR td img{
	width:4px;
	height:4px;
}


</style>



<SCRIPT LANGUAGE="JavaScript">

<!--

function get_obj(obj){

   return document.getElementById(obj);

}

//-->

</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">

<!--

function post(form){

	//提醒用户是否选择那个模板

	var ifck=0;

	for(var i=0;i<ImgLinks.length;i++){

		jpgpath=ImgLinks[i];

		if(get_obj("tplpath").value==jpgpath){

			if(upfile_PicNumId==i){

				ifck=1;

			}			

		}

	}

	if(get_obj("tplpath").value!=''&&ifck==0){

		var ck=confirm("你选中当前预览的模板,是否要选择?\n\n按确定,将返回选择!\n按取消,则不选择,而立即提交!");

	}

	if(ck==true){

		useThisTpl(ImgLinks[upfile_PicNumId]);

		return false;

	}
	if(form.tplpart_1.value==''){
		alert("模板不能为空,否则不能正常显示内容");
		form.tplpart_1.focus();
		return false;
	}

}

//-->

</SCRIPT>

<table width="100%" border="0" cellspacing="1" cellpadding="3" class="tablewidth">



    <tr  align="center"> 

      <td colspan="2"> &nbsp; 




        <table width="100%" border="0" cellspacing="1" cellpadding="3"  id="tb2">

          <tr  id="preview"> 

            <td > 

              <input type="hidden" name="tplpath" value="/scup/view/{VIEW_TYPE}/icon/{$htmlname}.html" id="tplpath">

              <table  border="0" cellspacing="0" cellpadding="0">

<tr><td style="padding-left:20px;padding-bottom:10px;"><select id="selectTyls" onChange="selectTpl(this)">
 <?php $biao = 0 ; $num = 1 ; ?>
    <option value='0'>快速选择</option>
   
<?php foreach((array)$htmlnamearray as $_key => $_value ) { ?>    
    <option value='{SITE_URL}/scup/view/{VIEW_TYPE}/icon/{$_key}.jpg'  >{$_key}</option>
	<?php if( $htmlname == $_key ) { $biao = $num ; } ?>
	<?php $num ++ ; ?>
<?php } ?>   
    <option value='0'></option>  

  </select> [<a href="#LOOK" onClick="show_MorePic(-1)">上一个</a>] 

      【<span id="upfile_PicNum">1/2</span>】[<a href="#LOOK" onClick="show_MorePic(1)">下一个</a>]  

       <span id="clickput"></span> 	

</td></tr>

  <tr>

    <td height="30" style="padding-left:20px;"><div id="showpicdiv" class="showpicdiv" ><A style="border:2px solid #fff;display:block;" HREF="#" onClick="show_MorePic(1)"  id="showPicID"><img border="0"  onload="if(this.height>200)this.height='200';" id="upfile_PicUrl"></A></div><div id="MSG_say"></div></td>

  </tr>

</table>

<SCRIPT LANGUAGE="JavaScript">

var ImgLinks= new Array(<?php foreach((array)$htmlnamearray as $_key => $_value ) { ?>"{SITE_URL}/scup/view/{VIEW_TYPE}/icon/{$_key}.jpg",<?php } ?>"");

var ImgTitle= new Array(<?php foreach((array)$htmlnamearray as $_key => $_value ) { ?>"{$_key}",<?php } ?>"");

function replace_img(url)
{
	return url;
}

</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
<!--
var upfile_PicNumId=0;

function show_MorePic(todo){

	if(todo==1){

		upfile_PicNumId++;

	}else if(todo==-1){

		upfile_PicNumId--;

	}

	if(upfile_PicNumId<0){

		alert("已经是第一个了!");

		upfile_PicNumId=0;

	}

	if( upfile_PicNumId>(ImgLinks.length-1) ){

		alert("已经是最后一个了!");

		upfile_PicNumId=ImgLinks.length-1;

	}

	showTplDiv();

	NUM=upfile_PicNumId+1;

	document.getElementById("selectTyls").options[NUM].selected = true;

}

show_MorePic({$biao})



function selectTpl(selObj){

	n=selObj.selectedIndex;

	value=selObj.options[n].value

	if(n<1){

		return;

	}

	upfile_PicNumId=n-1;

	showTplDiv();

}



function showTplDiv(){

	document.getElementById("upfile_PicNum").innerHTML="<font color=red>"+(upfile_PicNumId+1)+"</font>/"+ImgLinks.length;

	document.getElementById("clickput").innerHTML='<input onclick=useThisTpl("'+ImgLinks[upfile_PicNumId]+'") type="button" name="Submit" value="使用此模板" style="border:1px solid #000;background:red;color:#fff;">';

	upfile_PicUrl=document.getElementById("upfile_PicUrl");

	jpgpath=ImgLinks[upfile_PicNumId];

	if(get_obj("tplpath").value==jpgpath){

		get_obj("showpicdiv").className='showpicdiv2';

	}else{

		get_obj("showpicdiv").className='showpicdiv';

	}

	upfile_PicUrl.src=ImgLinks[upfile_PicNumId];
	upfile_PicUrl.alt=ImgTitle[upfile_PicNumId];	

	//让选中的模板红色显示

	for(var i=0;i<ImgLinks.length;i++){

		NUM=i+1;
		jpgpath=ImgLinks[i];
		if(get_obj("tplpath").value==jpgpath){

			document.getElementById("selectTyls").options[NUM].style.color = 'red';

		}else{

			document.getElementById("selectTyls").options[NUM].style.color = '#000';

		}

	}

	re   = /\.jpg/g;

	link_s = ImgLinks[upfile_PicNumId].replace(re, ".htm");

	get_obj("MSG_say").innerHTML="当前模板文件:<A title='你可以创建更多的模板放在此目录即可' HREF='"+link_s+"' target=_blank>"+link_s.replace(/(.*)\/scup\/view\//g,"/scup/view/")+"</A>";

}
//-->
</SCRIPT>

            </td>

          </tr>

          <tr  id="TRtpl_1">
            <td > 



                    <textarea name="tplpart_1" id="tplpart_1" cols="90" rows="8" style="height:250px;">{$code}</textarea>


            </td>

          </tr>
          <tr >
            <td > 
<input type="radio" name="mokuai" value="1"   >创建新模块&nbsp;&nbsp;&nbsp;<input type="radio" name="mokuai" value="0"  checked   >修改模块
            </td>
          </tr>


        </table>


      </td>

    </tr>

</table>



<script language="JavaScript">
function puthtmlcode(code)
{
	get_obj("tplpart_1").value=code;
	get_obj("tplpart_1").focus();
}

function useThisTpl(tpl)
{
	re   = /\.jpg/g;
	tpl = tpl.replace(re, ".html");	
	get_obj("tplpath").value=tpl.replace(/(.*)\/scup\/view\//g,"/scup/view/");
	get_obj("showpicdiv").className='showpicdiv2';
	window.open("?app=icon&act=viewmanagedataedit&action=getTplcode&divid=tplpart_1&filepath="+tpl,target='phpframe');
}

function loadtpl()
{
	for(var i=0;i<ImgLinks.length;i++)
	{
		jpgpath=ImgLinks[i];
		if(get_obj("tplpath").value==jpgpath)
		{
			upfile_PicNumId=i;
		}
	}
	NUM=upfile_PicNumId+1;
	document.getElementById("selectTyls").options[NUM].selected = true;
	showTplDiv();
}

loadtpl();

</script>

<iframe id="phpframe" name="phpframe" marginwidth="0" src="about:blank" frameborder="0" height="0" width="0"></iframe> 
    
    </td>
</tr>
 <SCRIPT LANGUAGE="JavaScript">
<!--

function MM_keyword2(selObj,str){ //v3.0
  va=selObj.options[selObj.selectedIndex].value
  if (va!='')
  {

		get_obj(str).value=va;

  } 
}

//-->
</script>	
<script>
function showinput()
{
    if(select_str=='')
	{
	alert('请先进行栏目选择！');
	return false;
	}

	var str=input.innerHTML;
	var num=2;
	var N=0;
	num=document.form1.nums.value;
	oo=document.body.getElementsByTagName("input");
	for(var j=0;j<oo.length;j++){	
		if(oo[j].getAttribute("name").indexOf('data')==0){		
			N++;
		}
	}

	for(var i=0;i<num;i++){
		N++;
		str+='Icon标签('+N+'):　　 <input type="text"  value=""  name="data['+N+'][datakey]"  size="20"   id="key_id_'+N+'">&nbsp;&nbsp;<select name="select3" onChange="MM_keyword2(this,\'key_id_'+N+'\')" ><option  value="">请选择...</option><option  value="icon">&nbsp;|&nbsp;&nbsp;&nbsp;icon</option><option  value="icon1">&nbsp;|&nbsp;&nbsp;&nbsp;icon1</option><option  value="icon2">&nbsp;|&nbsp;&nbsp;&nbsp;icon2</option><option  value="icon3">&nbsp;|&nbsp;&nbsp;&nbsp;icon3</option><option  value="icon4">&nbsp;|&nbsp;&nbsp;&nbsp;icon4</option><option  value="icon5">&nbsp;|&nbsp;&nbsp;&nbsp;icon5</option><option  value="icon6">&nbsp;|&nbsp;&nbsp;&nbsp;icon6</option><option  value="icon7">&nbsp;|&nbsp;&nbsp;&nbsp;icon7</option><option  value="icon8">&nbsp;|&nbsp;&nbsp;&nbsp;icon8</option><option  value="icon9">&nbsp;|&nbsp;&nbsp;&nbsp;icon9</option><option  value="icon10">&nbsp;|&nbsp;&nbsp;&nbsp;icon10</option></select><br/>';

		if(select_str)
		{
		str+='对应数据库字段名:　　<input type="text" name="data['+N+'][datavalue]" size="20" value=""  id="value_id_'+N+'" >&nbsp;&nbsp;<select name="select4" onChange="MM_keyword2(this,\'value_id_'+N+'\')" ><option  value="">请选择...</option>'+select_str+'</select><br><hr size=1 color="#FF0000">';			 
		}
		else
		{
		str+='对应数据库字段名:　　<input type="text" name="data['+N+'][datavalue]" size="20" value=""  id="value_id_'+N+'" ><br><hr size=1 color="#FF0000">';		
		}
	}
	input.innerHTML=str;
}
</script>

									 
    	                                 

<tr onMouseOut="this.className=''" onMouseOver="this.className='bgcolor'">
	<td align='right'><strong>值相对</strong><input  type="hidden" size="3" name="nums" value="1">
        <input type="button" name="Submit2" value="增加一项" class="buton" onClick=showinput()></td>
	<td>

     <div id=input>
<?php $num = 0 ; ?>	 
<?php foreach((array)$iconfielddata as $_key => $_value ) { ?>

Icon标签({$num}):　　 <input type="text"  value="{$_key}"  name="data[{$num}][datakey]"  size="20"   id="key_id_{$num}">&nbsp;&nbsp;
<select name="select3" onChange="MM_keyword2(this,'key_id_{$num}')" >
<option  value="">请选择...</option>
<option  value="icon">&nbsp;|&nbsp;&nbsp;&nbsp;icon</option>
<option  value="icon1">&nbsp;|&nbsp;&nbsp;&nbsp;icon1</option>
<option  value="icon2">&nbsp;|&nbsp;&nbsp;&nbsp;icon2</option>
<option  value="icon3">&nbsp;|&nbsp;&nbsp;&nbsp;icon3</option>
<option  value="icon4">&nbsp;|&nbsp;&nbsp;&nbsp;icon4</option>
<option  value="icon5">&nbsp;|&nbsp;&nbsp;&nbsp;icon5</option>
<option  value="icon6">&nbsp;|&nbsp;&nbsp;&nbsp;icon6</option>
<option  value="icon7">&nbsp;|&nbsp;&nbsp;&nbsp;icon7</option>
<option  value="icon8">&nbsp;|&nbsp;&nbsp;&nbsp;icon8</option>
<option  value="icon9">&nbsp;|&nbsp;&nbsp;&nbsp;icon9</option>
<option  value="icon10">&nbsp;|&nbsp;&nbsp;&nbsp;icon10</option>
</select><br/>
对应数据库字段名:　　<input type="text" name="data[{$num}][datavalue]" size="20" value="{$_value}"  id="value_id_{$num}" >&nbsp;&nbsp;
<select name="select4" onChange="MM_keyword2(this,'value_id_{$num}')" >
<option  value="">请选择...</option>
<?php foreach((array)$tablearray[$tablename] as $_key => $_value ) { ?>
<option  value="{$_value}">{$_key}</option>
<?php } ?>	 
</select>
<br><hr size=1 color="#FF0000">

<?php $num ++ ; ?>
<?php } ?>	 
	 
	 </div>	
	
	
	</td>
</tr>


<tr>
	<td>&nbsp;</td>
	<td><input type="hidden" name="pagename" value="{$pagename}" /><input type="hidden" name="strtempdata" value="{$strtempdata}" /><input type="hidden" name="fromurl" value="{$weburl}" /><input type="submit" value=" 提 交 " class="buton"></td>
</tr>
</tbody></table>
</form>                                 
                                 
  <div style="display:none;"> 

  <form name="form2" method="post" action="" target="phpframe">

  </form>

</div> 







	

        
        <div class="notic"><img  src="{$web_view_dir}style/images/light.gif" align="absmiddle" /> <b>提示: </b> <span ></span></div>
    </div>
</div>
<!--{inc(footer.view.html)}-->